﻿using DevExpress.Xpo;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Model.Base
{
    [NonPersistent]
    public class BaseXPObjectClass : XPObject
    {
        public BaseXPObjectClass(Session session) : base(session) { }

        [Persistent("Creator")]
        protected string _creator;
        [PersistentAlias("_creator"), Custom("IsVisibleInListView", "False")]
        [Custom("Caption", "创建者")]
        public string Creator
        {
            get { return _creator; }
            set { _creator = value; }
        }

        [Persistent("CreateDT")]
        protected DateTime _createDT;
        [PersistentAlias("_createDT"), Custom("IsVisibleInListView", "False")]
        [Custom("Caption", "创建时间")]
        public DateTime CreateDT
        {
            get { return _createDT; }
            set { _createDT = value; }
        }

        [Persistent("Operator")]
        protected string _operator;
        [PersistentAlias("_operator"), Custom("IsVisibleInListView", "False")]
        [Custom("Caption", "最后更新者")]
        public string Operator
        {
            get { return _operator; }
            set { _operator = value; }
        }

        [Persistent("UpdateDT")]
        protected DateTime _updateDT;
        [PersistentAlias("_updateDT"), Custom("IsVisibleInListView", "False")]
        [Custom("Caption", "最后更新时间")]
        public DateTime UpdateDT
        {
            get { return _updateDT; }
            set { _updateDT = value; }
        }

        [Persistent("Sort")]
        protected int _sort;
        [PersistentAlias("_sort"), Custom("IsVisibleInListView", "False")]
        [Custom("Caption", "排序")]
        public int Sort
        {
            get { return _sort; }
            set { _sort = value; }
        }

        [Persistent("Remark")]
        protected string _remark;
        [PersistentAlias("_remark"), Custom("IsVisibleInListView", "False")]
        [Custom("Caption", "备注")]
        public string Remark
        {
            get { return _remark; }
            set { _remark = value; }
        }
        public override void AfterConstruction()
        {
            base.AfterConstruction();
            this._creator = MemberInfo.User.LoginName;
            this._createDT = DateTime.Now;
        }
    }
}
